<!DOCTYPE HTML>
<html style="background: #f3f3f3;" lang="zh-cmn-Hans">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>法援宝</title>
    <link rel="stylesheet" type="text/css" href="../css/api.css" />
    <link rel="stylesheet" type="text/css" href="../css/style.css" />
    <link rel="stylesheet" type="text/css" href="../css/lawyer.css" />
    <script type="text/javascript" src="../script/api.js"></script>
    <script type="text/javascript" src="../script/jquery-1.9.1.min.js"></script>
    <script type="text/javascript" src="../script/mobile.js"></script>
    <script type="text/javascript" src="../script/lawyer.js"></script>
</head>
<body>
<div id="secHeader">
  <header class="header">
      <a href="javascript:void(0);" onclick="comeBack()" class="back_btn"><img src="../image/head-fanhui.png" alt=""></a>
      <h2>提现</h2>
      <!--<a href="javascript:void (0);" class="search_btn set_btn">设置</a>-->
  </header>
</div>
<section class="buy_order">
    <div class="product">
        <img src="../image/fyb_img.png" alt="">
        <div class="product_info">
            <p>法援宝</p>
            <span>余额提现</span>
        </div>
    </div>
    <div class="pay_price">
        <p>提现金额(元)</p>
        <input type="text" placeholder="请输入金额" id='money' name="money">
    </div>
    <div class="pay_price">
        <p>真实姓名</p>
        <input type="text" placeholder="请填写真实姓名"  id='name' name="name">
    </div>
    <div class="pay_kinds">
        <h6>提现到</h6>
        <div class="pay_list">
            <ul>
                <li data-id="2">
                    <div class="pay">
                        <img src="../image/pay1.png" alt="">
                        <div class="pay_info">
                            <p>支付宝</p>
                        </div>
                    </div>
                    <span class="checkbox"></span>
                </li>
                <li data-id="1">
                    <div class="pay">
                        <img src="../image/pay4.png" alt="">
                        <div class="pay_info">
                            <p>银行卡</p>
                        </div>
                    </div>
                    <!--<span id="cardno"></span>-->
                    <span class="checkbox"></span>
                </li>
            </ul>
        </div>
    </div>
</section>
<section class="reminder">
    <h6>温馨提示：</h6>
    <p>
        1、最低限额200元；<br> 2、提现手续费1%；<br> 3、若您充值未产生消费，可联系客服要求原路原值退回。
    </p>
</section>
<section class="calc_btn">
    <a href="javascript:void (0);">确认提现</a>
</section>


</body>

<script>

    var type=0;
    apiready = function () {
      $api.fixStatusBar( $api.dom('#secHeader') );
      api.setStatusBarStyle({
          style: 'light'
      });
        


        user()

    };




    function user() {
        var p={token:token,infock:2};
        api.ajax({
            url: webSiteUrl+'/app/user/user',
            method: 'post',
            data: {
                values:p
            }
        }, function(ret, err) {
            if(ret.code==200){

                var cardno=ret.data.cardno

                if(cardno != ''){
                    $("#cardno").html(cardno);
                }else{
                    alert('您尚未绑定银行卡号，无法提现')
                }

            }
        });

    }

    $('.calc_btn').click(function(){
        var name = $('input[name=name]').val();
        var money = $('input[name=money]').val();
        var cardno = $('#cardno').html();

        if(cardno == ''){
            alert('您尚未绑定银行卡号，无法提现');return;
        }
        if(name == ''){
            alert('请输入姓名！');return;
        }
        if(money == ''){
            alert('请输入金额！');return;
        }else if(!/^\d+$/.test(money)){
            alert('金额必须是数字！');return;
        }else if(money<200){
            alert('提现最低限额200元！');return;
        }
       if(type == ''){

            alert('请选择提现方式！');return;
        }
        var p={token:token,model:'tixian',name:name,money:money,pay_type:type};
        api.ajax({
            url: webSiteUrl+'/app/user/apply',
            method: 'post',
            data: {
                values:p
            }
        }, function(ret, err) {

            if(ret.code == 200){
                alert(ret.msg);
                comeBack()
            }else{
                alert(ret.msg);

            }

        });

    });


//选择支付方式
    $(".pay_list li").click(function () {

        type = $(this).attr('data-id');


        if($(this).find('.checkbox').length>0){
            $(this).addClass('active').siblings('li').removeClass('active');
        }
    });
</script>
</html>
